package com.mytime.database;


import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.json.JSONException;
import org.json.JSONObject;

@PersistenceCapable
public class Category {

	@PrimaryKey
	@Persistent
	private String id;
	
	@Persistent
	private String name;
	

	//***************//
	// Constructors //
	//*************//
	
	public Category() {
		
	}
	
	public Category(String id, String name) {
		this.id = id;
		this.name = name;
	}
	
	//***************//
	//Public Methods//
	//*************//

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	public JSONObject toJSON() {
		JSONObject categoryObj = new JSONObject();
		try {
			categoryObj.put("id", getId());
			categoryObj.put("name", getName());
			
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		return categoryObj;
	}

}
